package com.laihui.adapters;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.laihui.activity.R;
import com.laihui.entity.TenderRecordList;
import com.laihui.enums.LoanStatus;
import com.laihui.model.InvestRecord;
import com.laihui.utils.YXDate;
import com.laihui.viewholder.InvestRecordViewHolder;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

import java.text.DecimalFormat;

/**
 * Created by ST on 2017/7/22.
 */

public class TenderRecordAdapter extends RecyclerArrayAdapter<TenderRecordList.TenderRecord> {
    public TenderRecordAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent ,int viewType) {
        return new TenderRecordViewHolder(parent);
    }


    /**
     * Created by ST on 2017/7/22.
     */

    public class TenderRecordViewHolder extends BaseViewHolder<TenderRecordList.TenderRecord> {
        private TextView tv_invest_title,tv_status,  tv_invest_money, tv_collected_money, tv_apr;

        public TenderRecordViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_invest_record_new);
            tv_invest_title = $(R.id.tv_invest_title);//标的名字
            tv_status =  $(R.id.tv_status);
            tv_invest_money = $(R.id.tv_invest_money);//标的总金额
            tv_collected_money = $(R.id.tv_collected_money);//待收利息
            tv_apr = $(R.id.tv_apr);//年华利率
        }

        @Override
        public void setData(TenderRecordList.TenderRecord data) {
            super.setData(data);
            tv_invest_title.setText(data.name);
            tv_invest_money.setText(data.success_money);
            tv_collected_money.setText(data.interest);
            tv_apr.setText(data.apr);
            tv_status.setText(LoanStatus.getNamByValue(data.status));


        }
    }

}
